@extends('layouts.back_stage')
@section('style')
    @parent
    <link rel="stylesheet" href="{{env('CDN_DOMAIN_NAME')}}/css/commoncss/jquery.dataTables.min.css"/>
    <link href="{{env('CDN_DOMAIN_NAME')}}/css/daterangepicker-bs3.css" rel="stylesheet">
@endsection
@section('script')
    @parent
    <script src="{{env('CDN_DOMAIN_NAME')}}/js/commonjs/jquery.dataTables.min.js"></script>
    <script src="{{ env('CDN_DOMAIN_NAME') }}/js/moment.js" type="text/javascript"></script>
    <script src="{{ env('CDN_DOMAIN_NAME') }}/js/daterangepicker.js" type="text/javascript"></script>
@endsection
@section('content')
    <style>
        .address {
            border-color: #cfdadd;
            border-radius: 2px;
            width: 25%;
            height: 30px;
            padding: 6px 10px;
            font-size: 12px;
            line-height: 1.42857143;
            color: #555;
            background-color: #fff;
            background-image: none;
            border: 1px solid #cfdadd;
            box-shadow: none;
            -webkit-transition: border-color ease-in-out .15s, -webkit-box-shadow ease-in-out .15s;
            -o-transition: border-color ease-in-out .15s, box-shadow ease-in-out .15s;
        }
        table.dataTable thead .sorting:after,table.dataTable thead .sorting_desc:after{content: "";}
        .table-hover th,.table-hover td{text-align: center;}
        img{width:50px;height:50px;}
        /*.user_ul{border:1px dashed #999;width:800px;}*/
        /*.user_ul .user_li{padding:5px 20px;font-weight:bold;}*/
    </style>
    <div class="container">
        {{--<div style="padding:20px 0;overflow:hidden;">--}}
            {{--<h3 style="float: left;">用户信息</h3>--}}
        {{--</div>--}}
        {{--<ul class="user_ul">--}}
            {{--<input type="hidden" class="user_id" value="">--}}
            {{--<li class="user_li">沉淀邮费：111</li>--}}
            {{--<li class="user_li">用户手机：1111</li>--}}
            {{--<li class="user_li">收货地址：111</li>--}}
        {{--</ul>--}}
        <div style="padding:20px 20px 20px 0;overflow:hidden;"><h3 style="float:left;">详情</h3></div>
        <div class="pull-left" style="width: 100%;margin-bottom: 20px">
            <form action="/order/getHistoryOrderByUser" method="get" role="form" style="display: inline-block;margin-right: 10px">
                <label>日期:</label>
{{--                <input type="hidden" name="_token" value="{{ csrf_token() }}" />--}}
                <input type="hidden" name="id" value="{{$_GET['id']}}" />
                <input type="text" readonly style="width:180px;height:30px;" name="begin_end_time" id="reservation" class="address time1_time2" autocomplete="off" value="{{$req_info['time']}}" placeholder="选择起止时间" />
                <button type="submit" class="btn btn-info" id="sort_btn" style="margin-bottom:4px;">搜索</button>
                <label style="margin-left:30px;">总邮费:</label>
                <input class="address" style="width: 100px" readonly type="text"  value="{{sprintf("%.2f", $req_info['prices']['postage_estimate'])}}">
                <label>总价格:</label>
                <input class="address" style="width: 100px" readonly type="text"  value="{{sprintf("%.2f", $req_info['prices']['actual_price'])}}">
            </form>
            <a href="javascript:;" class="btn btn-primary" style="float: right;margin-right:30px;" onclick="Export();">导出</a>
        </div>
        <table class="table table-hover data-table" >
            <thead>
            <tr>
                <th class="nosort">图片</th>
                <th class="nosort">品牌</th>
                <th class="nosort">名称</th>
                <th class="nosort">颜色</th>
                <th>数量(手)</th>
                <th class="nosort">款号</th>
                <th>邮费</th>
                <th>价格</th>
                <th class="nosort">公司</th>
                <th class="nosort">订单生成时间</th>
                <th class="nosort">订单状态</th>
            </tr>
            </thead>
            <tbody>
            @foreach($order_infos as $k => $v)
                <tr>
                    <td><img src="{{ env('CDN_DOMAIN_NAME') }}/upload/{{ $v->face }}"></td>
                    <td>{{$brands[$v->brand_id]}}</td>
                    <td>{{$products[$v->pro_id] or '数据已删除'}}</td>
                    <td>{{$v->color}}</td>
                    <td>{{$v->num}}</td>
                    <td>{{$v->girard}}</td>
                    <td>{{ sprintf("%.2f", $v->postage_estimate)}}</td>
                    <td>{{ sprintf("%.2f", $v->actual_price)}}</td>
                    <td>{{$companys[$v->company_id]}}</td>
                    <td>{{$v->created_at}}</td>
                    <td>
                        @if($v->status == 0)
                            订单生成
                        @elseif($v->status == 1)
                            待支付
                        @elseif($v->status == 2)
                            订单超时关闭
                        @elseif($v->status == 3)
                            支付成功
                        @elseif($v->status == 6)
                            线下支付成功
                        @elseif($v->status == 4)
                            订单二维码绑定完成
                        @elseif($v->status == 5)
                            确认收货
                        @elseif($v->status == -1)
                            已删除
                        @elseif($v->status == 7)
                            已发货
                        @elseif($v->status == -4)
                            内部付款
                        @elseif($v->status == -3)
                            已退款
                        @endif
                    </td>
                </tr>
            @endforeach
            </tbody>
        </table>
    </div>
    <script>
        /*导出*/
        function Export()
        {
            var user_id = "{{ $_GET['id'] }}";
            var time1_time2 = $(".time1_time2").val();

            window.location.href = "/excel/userHistoryOrdersExport?user_id=" + user_id +
                "&time1_time2=" + time1_time2;
        }
            $('#reservation').daterangepicker(null, function(start, end, label) {
                console.log(start.toISOString(), end.toISOString(), label);
            });
        var lang = {
            "sProcessing": "处理中...",
            "sLengthMenu": "每页 _MENU_ 项",
            "sZeroRecords": "没有匹配结果",
            "sInfo": "当前显示第 _START_ 至 _END_ 项，共 _TOTAL_ 项。",
            "sInfoEmpty": "当前显示第 0 至 0 项，共 0 项",
            "sInfoFiltered": "(由 _MAX_ 项结果过滤)",
            "sInfoPostFix": "",
            "sSearch": "搜索:",
            "sUrl": "",
            "sEmptyTable": "表中数据为空",
            "sLoadingRecords": "载入中...",
            "sInfoThousands": ",",
            "oPaginate": {
                "sFirst": "首页",
                "sPrevious": "上页",
                "sNext": "下页",
                "sLast": "末页",
                "sJump": "跳转"
            },
            "oAria": {
                "sSortAscending": ": 以升序排列此列",
                "sSortDescending": ": 以降序排列此列"
            }
        };
        $('.data-table').dataTable({
            "language":lang,  //提示信息
            "searching": false,  //是否允许Datatables开启本地搜索
            "paging": true,  //是否开启本地分页
            "lengthChange": false,  //是否允许用户改变表格每页显示的记录数
            "iDisplayLength" : 10,// 每页显示行数
            "info": false,   //控制是否显示表格左下角的信息
            "sPaginationType" : "full_numbers", // 分页，一共两种样式 另一种为two_button // 是datatables默认
            "columnDefs": [{
                "targets": 'nosort',  //列的样式名
                "orderable": false    //包含上样式名‘nosort’的禁止排序
            }],
            //跟数组下标一样，第一列从0开始，这里表格初始化时，第四列默认降序
            "order": [3]  //asc升序   desc降序  "order": [[ 3, "desc" ]]默认第四列为降序排列
        });
    </script>
@endsection